import requests

API_URL = "https://api-inference.huggingface.co/models/uer/gpt2-chinese-cluecorpussmall"
API_TOKEN = "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"
headers = {"Authorization": f"Bearer {API_TOKEN}"}

response = requests.post(API_URL, headers=headers, json={"input":"你好，hugging face"})
print(response)
# {'generated_text': 'My name is Wolfgang and I live in Berlin'}